package com.ruoyi.slope.device.deviceInfo.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.slope.device.deviceInfo.mapper.SlopeDeviceInfoMapper;
import com.ruoyi.slope.device.deviceInfo.domain.SlopeDeviceInfo;
import com.ruoyi.slope.device.deviceInfo.service.ISlopeDeviceInfoService;

/**
 * 设备列表Service业务层处理
 * 
 * @author psy
 * @date 2025-05-10
 */
@Service
public class SlopeDeviceInfoServiceImpl implements ISlopeDeviceInfoService 
{
    @Autowired
    private SlopeDeviceInfoMapper slopeDeviceInfoMapper;

    /**
     * 查询设备列表
     * 
     * @param id 设备列表主键
     * @return 设备列表
     */
    @Override
    public SlopeDeviceInfo selectSlopeDeviceInfoById(Long id)
    {
        return slopeDeviceInfoMapper.selectSlopeDeviceInfoById(id);
    }

    /**
     * 查询设备列表列表
     * 
     * @param slopeDeviceInfo 设备列表
     * @return 设备列表
     */
    @DataScope(deptAlias = "s")
    @Override
    public List<SlopeDeviceInfo> selectSlopeDeviceInfoList(SlopeDeviceInfo slopeDeviceInfo)
    {
        return slopeDeviceInfoMapper.selectSlopeDeviceInfoList(slopeDeviceInfo);
    }

    /**
     * 查询设备Sn列表
     *
     * @param slopeDeviceInfo 设备列表
     * @return 设备Sn列表集合
     */
    @DataScope(deptAlias = "s")
    @Override
    public String[] selectSlopeDeviceSnList(SlopeDeviceInfo slopeDeviceInfo){
        List<SlopeDeviceInfo> list = slopeDeviceInfoMapper.selectSlopeDeviceSnList(slopeDeviceInfo);
        String[] result = new String[list.size()];
        for(int i=0;i<list.size();i++){
            result[i]=list.get(i).getDeviceSn();
        }
        return result;
    }

    /**
     * 新增设备列表
     * 
     * @param slopeDeviceInfo 设备列表
     * @return 结果
     */
    @Override
    public int insertSlopeDeviceInfo(SlopeDeviceInfo slopeDeviceInfo)
    {
        return slopeDeviceInfoMapper.insertSlopeDeviceInfo(slopeDeviceInfo);
    }

    /**
     * 修改设备列表
     * 
     * @param slopeDeviceInfo 设备列表
     * @return 结果
     */
    @Override
    public int updateSlopeDeviceInfo(SlopeDeviceInfo slopeDeviceInfo)
    {
        slopeDeviceInfo.setUpdateTime(DateUtils.getNowDate());
        return slopeDeviceInfoMapper.updateSlopeDeviceInfo(slopeDeviceInfo);
    }

    /**
     * 批量删除设备列表
     * 
     * @param ids 需要删除的设备列表主键
     * @return 结果
     */
    @Override
    public int deleteSlopeDeviceInfoByIds(Long[] ids)
    {
        return slopeDeviceInfoMapper.deleteSlopeDeviceInfoByIds(ids);
    }

    /**
     * 删除设备列表信息
     * 
     * @param id 设备列表主键
     * @return 结果
     */
    @Override
    public int deleteSlopeDeviceInfoById(Long id)
    {
        return slopeDeviceInfoMapper.deleteSlopeDeviceInfoById(id);
    }
}
